﻿using UnityEngine.UI;
using UnityEngine;
using UnityEngine.Events;

namespace WoogiUI
{
    public static class TextEx
    {
        public static Text SetValue(this Text t, string value)
        {
            if (t != null)
            {
                if (t.text != value)
                    t.text = value;
                return t;
            }
            return null;
        }

        public static Text SetValue(this Text t, Color value)
        {
            if (t != null)
            {
                if (t.color != value)
                    t.color = value;
                return t;
            }
            return null;
        }

       public static void OnValueChanged(this InputField t, UnityAction<string> OnCallback)
        {
            if (t != null)
                t.onValueChanged.AddListener(OnCallback);
        }
    }
}
